package com.yugao.fintech.libra.model.vo.user;

import com.yugao.fintech.libra.common.constants.ValidationCons;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;


@Getter
@Setter
@ToString
@Accessors(chain = true)
public class UserSaveReq extends UserBase {
    @Schema(description = "选择的角色ids, 逗号分割")
    private String roleIds;

    /** 选择的部门 */
    @Schema(description = "选择的部门ids, 逗号分割")
    private String deptIds;

    @Schema(description = "用户账号", example = "admin")
    @NotBlank(message = ValidationCons.NOT_EMPTY)
    @Pattern(regexp = "^[a-zA-Z0-9]{4,30}$", message = "用户账号由 数字、字母 组成")
    @Size(min = 4, max = 30, message = "用户账号长度为 4-30 个字符")
    private String userName;

    @Schema(description = "密码", example = "123456")
    @NotEmpty(message = ValidationCons.NOT_EMPTY)
    @Length(min = 4, max = 16, message = "密码长度为 4-16 位")
    private String password;
}
